<!DOCTYPE html>
<html>

<head>
		<% include ../../web/jingpeng/meta.html %>
        <% include global/top-css.html %>
			<title></title>
</head>

<body>

		<% include ../../web/jingpeng/header.html %>
        <section class="row">
            <img class="wauto" src="/static/web/jingpeng/img/news.jpg" alt="">
        </section>
		<section class="row pc-page content mt-10">
			<div class="m-form login center">
				<h2 class="c-277bc1 f-32 text-c">会员登录</h2>
				<p class="f-14 c-616161 text-c mb-20">京鹏山泉乃凤凰岭神泉脚下天然泉眼，健康饮水从此刻开始</p>
				<form action="/user/login" name="login" @submit.prevent="checkLogin" method="post">
					<ul id="login">

						<li class="row pd-10 mb-5 f-14">
						
							<div class="col-bd">
								<input type="text" name="user" v-model="params.user" placeholder="请输入用户名" class="input" value="" />
							</div>
						</li>

						<li class="row pd-10 mb-5 f-14">
							<div class="col-bd">
								<input type="password" name="pass" v-model="params.pass" placeholder="请输入密码" class="input" value="" />
								<a class="fr c-277bc1 f-14" href="/user/repass">忘记密码</a>
							</div>
						</li>

						<li class="pd-10">
							<input class="btn-block btn-login btn-primary bg-277bc1 pt-10 pb-10" type="submit" value="登录" />
						</li>
						<ul>
				</form>

				<p class="text-c">	<a href="/user/reg" class="c-277bc1 f-14">注册新账号></a></p>
			</div>
		</section>
		<% include global/footer.html %>
			<% include global/footer-js.html %>
				<script>
					var vm = new Vue({
						el: '.login',
						data: {
							yzm: 0000,
							params:{
								user:'',
								pass:''
							}
						},
						methods: {
							checkLogin: function () {
								var _this = this;
								var fm = document.login;

								if (fm.user.value == '' || fm.user.value.length < 2) {
									alert('用户名不得为空且不能小于两位！');
									fm.user.focus();
									return false;
								}

								if (fm.pass.value == '' || fm.pass.value.length < 6) {
									alert('密码不得为空且不能小于六位！');
									fm.pass.focus();
									return false;
								}

								$.ajax({
									url: "/user/login",
									data: _this.params,
									cache: false,
									type: "post",
									dataType: 'json',
									success: function (data) {
										if (data.success) {
											_this.$message('登录成功，2s后自动跳转到登录界面');
											setTimeout(function () {
												location.href = "/user/index"
											}, 2000)
										} else {
											_this.$message(data.msg)
										}
									}
								});

								//fm.submit();
							}
						},
						created: function () {
						},
						mounted: function () {
						},
						updated: function () {
						}
					});

				</script>
</body>

</html>